import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:yuan_hang_app/base/base_page.dart';
import 'package:yuan_hang_app/utils/size_utils.dart';
import 'package:yuan_hang_app/views/home/model/leads_call_log.dart';

import '../../../../../res/w_colors.dart';
import '../../../../../res/w_dimens.dart';
import '../../../../../widget/w_text.dart';

class LeadsCallLogList extends StatelessWidget {
  final Status? status;
  final List<LeadsCallLog>? logList;

  const LeadsCallLogList({super.key, this.logList, this.status = Status.NONE});

  @override
  Widget build(BuildContext context) {
    return BasePage(
        status: status,
        child: ListView.builder(
            padding: EdgeInsets.zero,
            itemCount: logList!.length,
            itemBuilder: _listItem
        )
    );
  }

  Widget _listItem(context, index) {
    LeadsCallLog item = logList![index];
    return Container(
      decoration: BoxDecoration(boxShadow: [
        BoxShadow(
            color: WColors.CDFEFFB,
            offset: const Offset(0, 1),
            blurRadius: 3.px)
      ], borderRadius: BorderRadius.circular(10.px), color: Colors.white),
      margin: EdgeInsets.symmetric(horizontal: 10.px, vertical: 5.px),
      padding: EdgeInsets.symmetric(horizontal: 10.px, vertical: 10.px),
      child: Row(
        children: [
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              WText(
                item.operatorTime ?? "",
                style: TextStyle(fontSize: WDimens.tsMedium, color:  WColors.mainTextColor),
              ),
              SizedBox(height: 10.px,),
              WText(
                item.operatorPersonName ?? "",
                style: TextStyle(fontSize: WDimens.tsMedium, color:  WColors.mainTextColor),
              ),
              SizedBox(height: 10.px,),
              WText(
                item.talkTimeShow ?? "",
                style: TextStyle(fontSize: WDimens.tsMedium, color:  WColors.mainTextColor),
              )
            ],
          ),
        ],
      ),
    );
  }
}